package com.CloudDream.Constants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public enum PlayerTabListEnum {
    FIRST(Arrays.asList("recipe", "table", "givegift", "give", "gift"), 0, null, 1);

    private final int num;

    private final String bef;

    private final int befPos;

    private final List<String> list;

    PlayerTabListEnum(List<String> list, int befPos, String bef, int num) {
        this.list = list;
        this.befPos = befPos;
        this.bef = bef;
        this.num = num;
    }

    public List<String> getList() {
        return this.list;
    }

    public int getBefPos() {
        return this.befPos;
    }

    public String getBef() {
        return this.bef;
    }

    public int getNum() {
        return this.num;
    }

    public static List<String> returnList(String[] args, int argsLength) {
        List<String> completions = new ArrayList<>();
        for (PlayerTabListEnum tabListEnum : values()) {
            if (tabListEnum.getBefPos() - 1 < args.length)
                if ((tabListEnum.getBef() == null || tabListEnum.getBef().equalsIgnoreCase(args[tabListEnum.getBefPos() - 1])) && tabListEnum
                        .getNum() == argsLength)
                    completions = tabListEnum.getList();
        }
        return completions;
    }
}
